class Solution:
    def strWithout3a3b(self, a: int, b: int) -> str:
        string = ''
        count = 1
        cur = 'a' if a > b else 'b'
        if cur == 'a':
            a -= 1
        else:
            b -= 1
        string += cur
        while a > 0 and b > 0:
            if a > b:
                nxt = 'a'
            else:
                nxt = 'b'
            if cur == nxt and count == 2:
                if nxt == 'a':
                    nxt = 'b'
                else:
                    nxt = 'a'
            string += nxt
            if nxt == 'a':
                a -= 1
            else:
                b -= 1
            if cur == nxt:
                count += 1
            else:
                count = 1
            cur = nxt
        while a > 0:
            string += 'a'
            a -= 1
        while b > 0:
            string += 'b'
            b -= 1
        return string
